package com.jinjie.exception;

import lombok.Getter;

/**
 * @program: com.jinjie.exception
 * @Description:
 * @author: Administrator
 * @create: 2024-02-04 16:26
 **/
@Getter
public enum CommonExceptionEnum {

    USER_DISABLE(40101,"用户被禁用！"),
    USER_DELETE(40102,"用户被删除！"),

    TOKEN_LEST(40145,"Token失效，请重新登录!"),
    NOT_LOGIN(40105,"系统未登录!"),
    NO_AUTHENTICATION(40104, "token无效"),
    SSO_LOGIN_CODE_GET_ERROR(40106, "账号已被锁定,请联系管理员!"),

    os(0,"")
;
    private final Integer code;
    private final String label;

    private CommonExceptionEnum(Integer code, String label) {
        this.code = code;
        this.label = label;
    }

    /**
     * 普通方法
     **/
    public static String getLabelByCode(Integer code) {
        for (CommonExceptionEnum c : CommonExceptionEnum.values()) {
            if (c.getCode().intValue() == code.intValue()) {
                return c.getLabel();
            }
        }
        return "";
    }
}
